//////////////////////////////////////////////////////////////////////////
// SWIG extensions for WinDBG interfaces
//////////////////////////////////////////////////////////////////////////


// Macro to get buffer
// Declare 2 variables: data##name and size##name
#define GET_BUFFER_FROM_BYTE_ARRAY(name, type, buf) \
type* data##name = NULL; \
ULONG size##name = 0; \
if (buf && (buf->Size() > 0)) \
{ \
	data##name = reinterpret_cast<type*>(buf->GetBuffer()); \
	size##name = buf->Size() / sizeof(type); \
}

// Definition of CallWithBufferExtension() see in interface *.i file


//////////////////////////////////////////////////////////////////////////
%extend IDebugAdvanced3
{
	HRESULT GetSourceFileInformation_(ULONG Which, PSTR SourceFile, ULONG64 Arg64, ULONG Arg32, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG InfoSize){
			return $self->GetSourceFileInformation(Which, SourceFile, Arg64, Arg32, Buffer, BufferSize, InfoSize);
		});
	}

	HRESULT FindSourceFileAndToken_(ULONG StartElement, ULONG64 ModAddr, PCSTR File, ULONG Flags, ByteArray* fileToken, PULONG FoundElement, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->FindSourceFileAndToken(StartElement, ModAddr, File, Flags, fileToken->GetBuffer(), fileToken->Size(), FoundElement, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolInformation_(ULONG Which, ULONG64 Arg64, ULONG Arg32, ByteArray* buffer, ByteArray* stringBuffer)
	{
		return CallWith2BufferExtension<BYTE, char>(buffer, stringBuffer,
			[&](PVOID Buffer1, ULONG BufferSize1, PULONG ReqSize1, PSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetSymbolInformation(Which, Arg64, Arg32, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetSystemObjectInformation_(ULONG Which, ULONG64 Arg64, ULONG Arg32, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG InfoSize){
			return $self->GetSystemObjectInformation(Which, Arg64, Arg32, Buffer, BufferSize, InfoSize);
		});
	}

	HRESULT GetSourceFileInformationWide_(ULONG Which, PWSTR SourceFile, ULONG64 Arg64, ULONG Arg32, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG InfoSize){
			return $self->GetSourceFileInformationWide(Which, SourceFile, Arg64, Arg32, Buffer, BufferSize, InfoSize);
		});
	}

	HRESULT FindSourceFileAndTokenWide_(ULONG StartElement, ULONG64 ModAddr, PCWSTR File, ULONG Flags, ByteArray* fileToken, PULONG FoundElement, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG InfoSize){
			return $self->FindSourceFileAndTokenWide(StartElement, ModAddr, File, Flags, fileToken->GetBuffer(), fileToken->Size(), FoundElement	, Buffer, BufferSize, InfoSize);
		});
	}

	HRESULT GetSymbolInformationWide_(ULONG Which, ULONG64 Arg64, ULONG Arg32, ByteArray* buffer, ByteArray* stringBuffer)
	{
		return CallWith2BufferExtension<BYTE, WCHAR>(buffer, stringBuffer,
			[&](PVOID Buffer1, ULONG BufferSize1, PULONG ReqSize1, PWSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetSymbolInformationWide(Which, Arg64, Arg32, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}
}


//////////////////////////////////////////////////////////////////////////
%extend IDebugClient7
{
	HRESULT GetRunningProcessSystemIds_(ULONG64 Server, ByteArray* buffer)
	{
		return CallWithBufferExtension<ULONG>(buffer, [&](PULONG Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetRunningProcessSystemIds(Server, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetRunningProcessDescription_(ULONG64 Server, ULONG SystemId, ULONG Flags, ByteArray* ExeName, ByteArray* Description)
	{
		return CallWith2BufferExtension<char, char>(ExeName, Description,
			[&](PSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetRunningProcessDescription(Server, SystemId, Flags, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetOutputLinePrefix_(ByteArray* prefix)
	{
		return CallWithBufferExtension<char>(prefix, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetOutputLinePrefix(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetIdentity_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetIdentity(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetRunningProcessDescriptionWide_(ULONG64 Server, ULONG SystemId, ULONG Flags, ByteArray* ExeName, ByteArray* Description)
	{
		return CallWith2BufferExtension<WCHAR, WCHAR>(ExeName, Description,
			[&](PWSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PWSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetRunningProcessDescriptionWide(Server, SystemId, Flags, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetDumpFile_(ULONG Index, ByteArray* buffer, PULONG64 Handle, PULONG Type)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetDumpFile(Index, Buffer, BufferSize, ReqSize, Handle, Type);
		});
	}

	HRESULT GetDumpFileWide_(ULONG Index, ByteArray* buffer, PULONG64 Handle, PULONG Type)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetDumpFileWide(Index, Buffer, BufferSize, ReqSize, Handle, Type);
		});
	}

	HRESULT GetOutputLinePrefixWide_(ByteArray* prefix)
	{
		return CallWithBufferExtension<WCHAR>(prefix, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetOutputLinePrefixWide(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetIdentityWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetIdentityWide(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetQuitLockString_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetQuitLockString(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetQuitLockStringWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetQuitLockStringWide(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT SetClientContext_(ByteArray* ctx)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Context, BYTE, ctx);
		return $self->SetClientContext(dataContext, sizeContext);
	}
}


//////////////////////////////////////////////////////////////////////////
%extend IDebugControl7
{
	HRESULT GetLogFile_(ByteArray* buffer, PBOOL Append)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetLogFile(Buffer, BufferSize, ReqSize, Append);
		});
	}

	HRESULT Disassemble_(ULONG64 Offset, ULONG Flags, ByteArray* buffer, PULONG64 EndOffset)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->Disassemble(Offset, Flags, Buffer, BufferSize, ReqSize, EndOffset);
		});
	}

	HRESULT GetSystemVersion_(PULONG PlatformId, PULONG Major, PULONG Minor, ByteArray* servicePackString, PULONG ServicePackNumber, ByteArray* buildString)
	{
		return CallWith2BufferExtension<char, char>(servicePackString, buildString,
			[&](PSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetSystemVersion(PlatformId, Major, Minor, Buffer1, BufferSize1, ReqSize1, ServicePackNumber, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetProcessorTypeNames_(ULONG Type, ByteArray* fullNameBuffer, ByteArray* abbrevNameBuffer)
	{
		return CallWith2BufferExtension<char, char>(fullNameBuffer, abbrevNameBuffer,
			[&](PSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetProcessorTypeNames(Type, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetTextMacro_(ULONG Slot, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetTextMacro(Slot, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetBreakpointParameters_(ULONG Count, ByteArray* ids, ULONG Start, ByteArray* params)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Ids, ULONG, ids);
		if (sizeIds < Count)
			return E_INVALIDARG;
		if (params)
			params->Resize(Count * sizeof(DEBUG_BREAKPOINT_PARAMETERS));
		return $self->GetBreakpointParameters(Count, dataIds, Start, (params ? reinterpret_cast<DEBUG_BREAKPOINT_PARAMETERS*>(params->GetBuffer()) : NULL));
	}

	HRESULT GetEventFilterText_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetEventFilterText(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetEventFilterCommand_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetEventFilterCommand(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSpecificFilterParameters_(ULONG Start, ULONG Count, ByteArray* params)
	{
		if (params)
			params->Resize(Count * sizeof(DEBUG_SPECIFIC_FILTER_PARAMETERS));
		return $self->GetSpecificFilterParameters(Start, Count, (params ? reinterpret_cast<DEBUG_SPECIFIC_FILTER_PARAMETERS*>(params->GetBuffer()) : NULL));
	}

	HRESULT SetSpecificFilterParameters_(ULONG Start, ULONG Count, ByteArray* params)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Params, DEBUG_SPECIFIC_FILTER_PARAMETERS, params);
		if (sizeParams < Count)
			return E_INVALIDARG;
		return $self->SetSpecificFilterParameters(Start, Count, (params ? reinterpret_cast<DEBUG_SPECIFIC_FILTER_PARAMETERS*>(params->GetBuffer()) : NULL));
	}

	HRESULT GetSpecificFilterArgument_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSpecificFilterArgument(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetExceptionFilterParameters_(ULONG Count, ByteArray* codes, ULONG Start, ByteArray* params)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Codes, ULONG, codes);
		if (sizeCodes < Count)
			return E_INVALIDARG;
		if (params)
			params->Resize(Count * sizeof(DEBUG_EXCEPTION_FILTER_PARAMETERS));
		return $self->GetExceptionFilterParameters(Count, dataCodes, Start, (params ? reinterpret_cast<DEBUG_EXCEPTION_FILTER_PARAMETERS*>(params->GetBuffer()) : NULL));
	}

	HRESULT SetExceptionFilterParameters_(ULONG Count, ByteArray* params)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Params, DEBUG_EXCEPTION_FILTER_PARAMETERS, params);
		if (sizeParams < Count)
			return E_INVALIDARG;
		return $self->SetExceptionFilterParameters(Count, (params ? reinterpret_cast<DEBUG_EXCEPTION_FILTER_PARAMETERS*>(params->GetBuffer()) : NULL));
	}

	HRESULT GetExceptionFilterSecondCommand_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetExceptionFilterSecondCommand(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetLastEventInformation_(PULONG Type, PULONG ProcessId, PULONG ThreadId, ByteArray* extraInformation, ByteArray* description)
	{
		return CallWith2BufferExtension<BYTE, char>(extraInformation, description,
			[&](PVOID Buffer1, ULONG BufferSize1, PULONG ReqSize1, PSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetLastEventInformation(Type, ProcessId, ThreadId, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetTextReplacement_(PCSTR SrcText, ULONG Index, ByteArray* srcBuffer, ByteArray* dstBuffer)
	{
		return CallWith2BufferExtension<char, char>(srcBuffer, dstBuffer,
			[&](PSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetTextReplacement(SrcText, Index, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetExpressionSyntaxNames_(ULONG Index, ByteArray* fullNameBuffer, ByteArray* abbrevNameBuffer)
	{
		return CallWith2BufferExtension<char, char>(fullNameBuffer, abbrevNameBuffer,
			[&](PSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetExpressionSyntaxNames(Index, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetEventIndexDescription_(ULONG Index, ULONG Which, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetEventIndexDescription(Index, Which, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetLogFileWide_(ByteArray* buffer, PBOOL Append)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetLogFileWide(Buffer, BufferSize, ReqSize, Append);
		});
	}

	HRESULT DisassembleWide_(ULONG64 Offset, ULONG Flags, ByteArray* buffer, PULONG64 EndOffset)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->DisassembleWide(Offset, Flags, Buffer, BufferSize, ReqSize, EndOffset);
		});
	}

	HRESULT GetProcessorTypeNamesWide_(ULONG Type, ByteArray* fullNameBuffer, ByteArray* abbrevNameBuffer)
	{
		return CallWith2BufferExtension<WCHAR, WCHAR>(fullNameBuffer, abbrevNameBuffer,
			[&](PWSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PWSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetProcessorTypeNamesWide(Type, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetTextMacroWide_(ULONG Slot, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetTextMacroWide(Slot, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetEventFilterTextWide_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetEventFilterTextWide(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetEventFilterCommandWide_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetEventFilterCommandWide(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSpecificFilterArgumentWide_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSpecificFilterArgumentWide(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetExceptionFilterSecondCommandWide_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetExceptionFilterSecondCommandWide(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetLastEventInformationWide_(PULONG Type, PULONG ProcessId, PULONG ThreadId, ByteArray* extraInformation, ByteArray* description)
	{
		return CallWith2BufferExtension<BYTE, WCHAR>(extraInformation, description,
			[&](PVOID Buffer1, ULONG BufferSize1, PULONG ReqSize1, PWSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetLastEventInformationWide(Type, ProcessId, ThreadId, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetTextReplacementWide_(PCWSTR SrcText, ULONG Index, ByteArray* srcBuffer, ByteArray* dstBuffer)
	{
		return CallWith2BufferExtension<WCHAR, WCHAR>(srcBuffer, dstBuffer,
			[&](PWSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PWSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetTextReplacementWide(SrcText, Index, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetExpressionSyntaxNamesWide_(ULONG Index, ByteArray* fullNameBuffer, ByteArray* abbrevNameBuffer)
	{
		return CallWith2BufferExtension<WCHAR, WCHAR>(fullNameBuffer, abbrevNameBuffer,
			[&](PWSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PWSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetExpressionSyntaxNamesWide(Index, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetEventIndexDescriptionWide_(ULONG Index, ULONG Which, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetEventIndexDescriptionWide(Index, Which, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetLogFile2_(ByteArray* buffer, PULONG Flags)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetLogFile2(Buffer, BufferSize, ReqSize, Flags);
		});
	}

	HRESULT GetLogFile2Wide_(ByteArray* buffer, PULONG Flags)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetLogFile2Wide(Buffer, BufferSize, ReqSize, Flags);
		});
	}

	HRESULT GetSystemVersionString_(ULONG Which, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSystemVersionString(Which, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSystemVersionStringWide_(ULONG Which, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSystemVersionStringWide(Which, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetContextStackTrace_(ByteArray* startContext, ByteArray* frames,  ByteArray* frameContexts, ULONG FrameContextsEntrySize, PULONG FramesFilled)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(StartContext, BYTE, startContext);
		GET_BUFFER_FROM_BYTE_ARRAY(Frames, DEBUG_STACK_FRAME, frames);
		GET_BUFFER_FROM_BYTE_ARRAY(FrameContexts, BYTE, frameContexts);
		return $self->GetContextStackTrace(dataStartContext, sizeStartContext, dataFrames, sizeFrames, dataFrameContexts, sizeFrameContexts, FrameContextsEntrySize, FramesFilled);
	}

	HRESULT OutputContextStackTrace_(ULONG OutputControl, ByteArray* frames, ByteArray* frameContexts, ULONG FrameContextsEntrySize, ULONG Flags)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Frames, DEBUG_STACK_FRAME, frames);
		GET_BUFFER_FROM_BYTE_ARRAY(FrameContexts, BYTE, frameContexts);
		return $self->OutputContextStackTrace(OutputControl, dataFrames, sizeFrames, dataFrameContexts, sizeFrameContexts, FrameContextsEntrySize, Flags);
	}

	HRESULT GetStoredEventInformation_(PULONG Type, PULONG ProcessId, PULONG ThreadId, ByteArray* context, ByteArray* extraInformation)
	{
		return CallWith2BufferExtension<BYTE, BYTE>(context, extraInformation,
			[&](PVOID Buffer1, ULONG BufferSize1, PULONG ReqSize1, PVOID Buffer2, ULONG BufferSize2, PULONG ReqSize2){
				return $self->GetStoredEventInformation(Type, ProcessId, ThreadId, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2);
		});
	}

	HRESULT GetManagedStatus_(PULONG Flags, ULONG WhichString, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetManagedStatus(Flags, WhichString, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetManagedStatusWide_(PULONG Flags, ULONG WhichString, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetManagedStatusWide(Flags, WhichString, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetStackTraceEx_(ULONG64 FrameOffset, ULONG64 StackOffset, ULONG64 InstructionOffset, ByteArray* frames, PULONG FramesFilled)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Frames, DEBUG_STACK_FRAME_EX, frames);
		return $self->GetStackTraceEx(FrameOffset, StackOffset, InstructionOffset, dataFrames, sizeFrames, FramesFilled);
	}

	HRESULT OutputStackTraceEx_(ULONG OutputControl, ByteArray* frames, ULONG Flags)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Frames, DEBUG_STACK_FRAME_EX, frames);
		return $self->OutputStackTraceEx(OutputControl, dataFrames, sizeFrames, Flags);
	}

	HRESULT GetContextStackTraceEx_(ByteArray* startContext, ByteArray* frames,  ByteArray* frameContexts, ULONG FrameContextsEntrySize, PULONG FramesFilled)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(StartContext, BYTE, startContext);
		GET_BUFFER_FROM_BYTE_ARRAY(Frames, DEBUG_STACK_FRAME_EX, frames);
		GET_BUFFER_FROM_BYTE_ARRAY(FrameContexts, BYTE, frameContexts);
		return $self->GetContextStackTraceEx(dataStartContext, sizeStartContext, dataFrames, sizeFrames, dataFrameContexts, sizeFrameContexts, FrameContextsEntrySize, FramesFilled);
	}

	HRESULT OutputContextStackTraceEx_(ULONG OutputControl, ByteArray* frames, ByteArray* frameContexts, ULONG FrameContextsEntrySize, ULONG Flags)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Frames, DEBUG_STACK_FRAME_EX, frames);
		GET_BUFFER_FROM_BYTE_ARRAY(FrameContexts, BYTE, frameContexts);
		return $self->OutputContextStackTraceEx(OutputControl, dataFrames, sizeFrames, dataFrameContexts, sizeFrameContexts, FrameContextsEntrySize, Flags);
	}
}


//////////////////////////////////////////////////////////////////////////
%extend IDebugBreakpoint3
{
	HRESULT GetCommand_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetCommand(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetOffsetExpression_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetOffsetExpression(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetCommandWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetCommandWide(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetOffsetExpressionWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetOffsetExpressionWide(Buffer, BufferSize, ReqSize);
		});
	}
}


//////////////////////////////////////////////////////////////////////////
%extend IDebugDataSpaces4
{
	HRESULT ReadVirtual_(ULONG64 Offset, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadVirtual(Offset, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WriteVirtual_(ULONG64 Offset, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WriteVirtual(Offset, dataBuffer, sizeBuffer, BytesWritten);
	}

	HRESULT SearchVirtual_(ULONG64 Offset, ULONG64 Length, ByteArray* pattern, ULONG PatternGranularity, PULONG64 MatchOffset)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Pattern, BYTE, pattern);
		return $self->SearchVirtual(Offset, Length, dataPattern, sizePattern, PatternGranularity, MatchOffset);
	}

	HRESULT ReadVirtualUncached_(ULONG64 Offset, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadVirtualUncached(Offset, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WriteVirtualUncached_(ULONG64 Offset, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WriteVirtualUncached(Offset, dataBuffer, sizeBuffer, BytesWritten);
	}

	HRESULT ReadPointersVirtual_(ULONG Count, ULONG64 Offset, ByteArray* ptrs)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Ptrs, ULONG64, ptrs);
		return $self->ReadPointersVirtual(Count, Offset, dataPtrs);
	}

	HRESULT WritePointersVirtual_(ULONG Count, ULONG64 Offset, ByteArray* ptrs)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Ptrs, ULONG64, ptrs);
		return $self->WritePointersVirtual(Count, Offset, dataPtrs);
	}

	HRESULT ReadPhysical_(ULONG64 Offset, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadPhysical(Offset, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WritePhysical_(ULONG64 Offset, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WritePhysical(Offset, dataBuffer, sizeBuffer, BytesWritten);
	}

	HRESULT ReadControl_(ULONG Processor, ULONG64 Offset, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadControl(Processor, Offset, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WriteControl_(ULONG Processor, ULONG64 Offset, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WriteControl(Processor, Offset, dataBuffer, sizeBuffer, BytesWritten);
	}

	HRESULT ReadIo_(ULONG InterfaceType, ULONG BusNumber, ULONG AddressSpace, ULONG64 Offset, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadIo(InterfaceType, BusNumber, AddressSpace, Offset, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WriteIo_(ULONG InterfaceType, ULONG BusNumber, ULONG AddressSpace, ULONG64 Offset, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WriteIo(InterfaceType, BusNumber, AddressSpace, Offset, dataBuffer, sizeBuffer, BytesWritten);
	}

	HRESULT ReadBusData_(ULONG BusDataType, ULONG BusNumber, ULONG SlotNumber, ULONG Offset, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadBusData(BusDataType, BusNumber, SlotNumber, Offset, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WriteBusData_(ULONG BusDataType, ULONG BusNumber, ULONG SlotNumber, ULONG Offset, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WriteBusData(BusDataType, BusNumber, SlotNumber, Offset, dataBuffer, sizeBuffer, BytesWritten);
	}

	HRESULT ReadDebuggerData_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG DataSize){
			return $self->ReadDebuggerData(Index, Buffer, BufferSize, DataSize);
		});
	}

	HRESULT ReadProcessorSystemData_(ULONG Processor, ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG DataSize){
			return $self->ReadProcessorSystemData(Processor, Index, Buffer, BufferSize, DataSize);
		});
	}

	HRESULT GetVirtualTranslationPhysicalOffsets_(ULONG64 Virtual, ByteArray* offsets, PULONG Levels)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Offsets, ULONG64, offsets);
		return $self->GetVirtualTranslationPhysicalOffsets(Virtual, dataOffsets, sizeOffsets, Levels);
	}

	HRESULT ReadHandleData_(ULONG64 Handle, ULONG DataType, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG DataSize){
			return $self->ReadHandleData(Handle, DataType, Buffer, BufferSize, DataSize);
		});
	}

	HRESULT FillVirtual_(ULONG64 Start, ULONG Size, ByteArray* pattern, PULONG Filled)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Pattern, BYTE, pattern);
		return $self->FillVirtual(Start, Size, dataPattern, sizePattern, Filled);
	}

	HRESULT FillPhysical_(ULONG64 Start, ULONG Size, ByteArray* pattern, PULONG Filled)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Pattern, BYTE, pattern);
		return $self->FillPhysical(Start, Size, dataPattern, sizePattern, Filled);
	}

	HRESULT ReadTagged_(LPGUID Tag, ULONG Offset, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG DataSize){
			return $self->ReadTagged(Tag, Offset, Buffer, BufferSize, DataSize);
		});
	}

	HRESULT GetOffsetInformation_(ULONG Space, ULONG Which, ULONG64 Offset, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG DataSize){
			return $self->GetOffsetInformation(Space, Which, Offset, Buffer, BufferSize, DataSize);
		});
	}

	HRESULT SearchVirtual2_(ULONG64 Offset, ULONG64 Length, ULONG Flags, ByteArray* pattern, ULONG PatternGranularity, PULONG64 MatchOffset)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Pattern, BYTE, pattern);
		return $self->SearchVirtual2(Offset, Length, Flags, dataPattern, sizePattern, PatternGranularity, MatchOffset);
	}

	HRESULT ReadMultiByteStringVirtual_(ULONG64 Offset, ULONG MaxBytes, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->ReadMultiByteStringVirtual(Offset, MaxBytes, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT ReadMultiByteStringVirtualWide_(ULONG64 Offset, ULONG MaxBytes, ULONG CodePage, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->ReadMultiByteStringVirtualWide(Offset, MaxBytes, CodePage, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT ReadUnicodeStringVirtual_(ULONG64 Offset, ULONG MaxBytes, ULONG CodePage, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->ReadUnicodeStringVirtual(Offset, MaxBytes, CodePage, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT ReadUnicodeStringVirtualWide_(ULONG64 Offset, ULONG MaxBytes, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->ReadUnicodeStringVirtualWide(Offset, MaxBytes, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT ReadPhysical2_(ULONG64 Offset, ULONG Flags, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadPhysical2(Offset, Flags, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WritePhysical2_(ULONG64 Offset, ULONG Flags, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WritePhysical2(Offset, Flags, dataBuffer, sizeBuffer, BytesWritten);
	}
}


//////////////////////////////////////////////////////////////////////////
%extend IDebugRegisters2
{
	HRESULT GetDescription_(ULONG Register, ByteArray* nameBuffer, PDEBUG_REGISTER_DESCRIPTION Desc)
	{
		return CallWithBufferExtension<char>(nameBuffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetDescription(Register, Buffer, BufferSize, ReqSize, Desc);
		});
	}

	HRESULT GetValues_(ByteArray* indices, ULONG Start, ByteArray* values)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Indices, ULONG, indices);
		if (sizeIndices == 0)
			return E_INVALIDARG;
		values->Resize(sizeIndices * sizeof(DEBUG_VALUE));
		GET_BUFFER_FROM_BYTE_ARRAY(Values, DEBUG_VALUE, values);
		return $self->GetValues(sizeIndices, dataIndices, Start, dataValues);
	}

	HRESULT SetValues_(ByteArray* indices, ULONG Start, ByteArray* values)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Indices, ULONG, indices);
		GET_BUFFER_FROM_BYTE_ARRAY(Values, DEBUG_VALUE, values);
		if (sizeIndices > sizeValues)
			return E_INVALIDARG;
		return $self->SetValues(sizeIndices, dataIndices, Start, dataValues);
	}

	HRESULT GetDescriptionWide_(ULONG Register, ByteArray* nameBuffer, PDEBUG_REGISTER_DESCRIPTION Desc)
	{
		return CallWithBufferExtension<WCHAR>(nameBuffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetDescriptionWide(Register, Buffer, BufferSize, ReqSize, Desc);
		});
	}

	HRESULT GetPseudoDescription_(ULONG Register, ByteArray* nameBuffer, PULONG64 TypeModule, PULONG TypeId)
	{
		return CallWithBufferExtension<char>(nameBuffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetPseudoDescription(Register, Buffer, BufferSize, ReqSize, TypeModule, TypeId);
		});
	}

	HRESULT GetPseudoDescriptionWide_(ULONG Register, ByteArray* nameBuffer, PULONG64 TypeModule, PULONG TypeId)
	{
		return CallWithBufferExtension<WCHAR>(nameBuffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetPseudoDescriptionWide(Register, Buffer, BufferSize, ReqSize, TypeModule, TypeId);
		});
	}

	HRESULT GetPseudoValues_(ULONG Source, ByteArray* indices, ULONG Start, ByteArray* values)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Indices, ULONG, indices);
		if (sizeIndices == 0)
			return E_INVALIDARG;
		values->Resize(sizeIndices * sizeof(DEBUG_VALUE));
		GET_BUFFER_FROM_BYTE_ARRAY(Values, DEBUG_VALUE, values);
		return $self->GetPseudoValues(Source, sizeIndices, dataIndices, Start, dataValues);
	}

	HRESULT SetPseudoValues_(ULONG Source, ByteArray* indices, ULONG Start, ByteArray* values)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Indices, ULONG, indices);
		GET_BUFFER_FROM_BYTE_ARRAY(Values, DEBUG_VALUE, values);
		if (sizeIndices > sizeValues)
			return E_INVALIDARG;
		return $self->SetPseudoValues(Source, sizeIndices, dataIndices, Start, dataValues);
	}

	HRESULT GetValues2_(ULONG Source, ByteArray* indices, ULONG Start, ByteArray* values)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Indices, ULONG, indices);
		if (sizeIndices == 0)
			return E_INVALIDARG;
		values->Resize(sizeIndices * sizeof(DEBUG_VALUE));
		GET_BUFFER_FROM_BYTE_ARRAY(Values, DEBUG_VALUE, values);
		return $self->GetValues2(Source, sizeIndices, dataIndices, Start, dataValues);
	}

	HRESULT SetValues2_(ULONG Source, ByteArray* indices, ULONG Start, ByteArray* values)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Indices, ULONG, indices);
		GET_BUFFER_FROM_BYTE_ARRAY(Values, DEBUG_VALUE, values);
		if (sizeIndices > sizeValues)
			return E_INVALIDARG;
		return $self->SetValues2(Source, sizeIndices, dataIndices, Start, dataValues);
	}
}


//////////////////////////////////////////////////////////////////////////
%extend IDebugSymbols5
{
	HRESULT GetNameByOffset_(ULONG64 Offset, ByteArray* nameBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<char>(nameBuffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetNameByOffset(Offset, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetNearNameByOffset_(ULONG64 Offset, LONG Delta, ByteArray* nameBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<char>(nameBuffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetNearNameByOffset(Offset, Delta, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetLineByOffset_(ULONG64 Offset, PULONG Line, ByteArray* fileBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<char>(fileBuffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetLineByOffset(Offset, Line, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetModuleNames_(ULONG Index, ULONG64 Base, ByteArray* imageNameBuffer, ByteArray* moduleNameBuffer, ByteArray* loadedImageNameBuffer)
	{
		return CallWith3BufferExtension<char, char, char>(imageNameBuffer, moduleNameBuffer, loadedImageNameBuffer,
			[&](PSTR Buffer1, ULONG BufferSize1, PULONG ReqSize1, PSTR Buffer2, ULONG BufferSize2, PULONG ReqSize2, PSTR Buffer3, ULONG BufferSize3, PULONG ReqSize3){
				return $self->GetModuleNames(Index, Base, Buffer1, BufferSize1, ReqSize1, Buffer2, BufferSize2, ReqSize2, Buffer3, BufferSize3, ReqSize3);
		});
	}

	HRESULT GetModuleParameters_(ByteArray* bases, ULONG Start, ByteArray* params)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Bases, ULONG64, bases);
		if (sizeBases == 0)
			return E_INVALIDARG;
		params->Resize(sizeBases * sizeof(DEBUG_MODULE_PARAMETERS));
		GET_BUFFER_FROM_BYTE_ARRAY(Params, DEBUG_MODULE_PARAMETERS, params);
		return $self->GetModuleParameters(sizeBases, dataBases, Start, dataParams);
	}

	HRESULT GetTypeName_(ULONG64 Module, ULONG TypeId, ByteArray* nameBuffer)
	{
		return CallWithBufferExtension<char>(nameBuffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetTypeName(Module, TypeId, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT ReadTypedDataVirtual_(ULONG64 Offset, ULONG64 Module, ULONG TypeId, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadTypedDataVirtual(Offset, Module, TypeId, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WriteTypedDataVirtual_(ULONG64 Offset, ULONG64 Module, ULONG TypeId, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WriteTypedDataVirtual(Offset, Module, TypeId, dataBuffer, sizeBuffer, BytesWritten);
	}

	HRESULT ReadTypedDataPhysical_(ULONG64 Offset, ULONG64 Module, ULONG TypeId, ByteArray* buffer, PULONG BytesRead)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->ReadTypedDataPhysical(Offset, Module, TypeId, dataBuffer, sizeBuffer, BytesRead);
	}

	HRESULT WriteTypedDataPhysical_(ULONG64 Offset, ULONG64 Module, ULONG TypeId, ByteArray* buffer, PULONG BytesWritten)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, BYTE, buffer);
		return $self->WriteTypedDataPhysical(Offset, Module, TypeId, dataBuffer, sizeBuffer, BytesWritten);
	}

	HRESULT GetScope_(PULONG64 InstructionOffset, PDEBUG_STACK_FRAME ScopeFrame, ByteArray* scopeContext)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(ScopeContext, BYTE, scopeContext);
		return $self->GetScope(InstructionOffset, ScopeFrame, dataScopeContext, sizeScopeContext);
	}

	HRESULT SetScope_(ULONG64 InstructionOffset, PDEBUG_STACK_FRAME ScopeFrame, ByteArray* scopeContext)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(ScopeContext, BYTE, scopeContext);
		return $self->SetScope(InstructionOffset, ScopeFrame, dataScopeContext, sizeScopeContext);
	}

	HRESULT GetNextSymbolMatch_(ULONG64 Handle, ByteArray* buffer, PULONG MatchSize, PULONG64 Offset)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, char, buffer);
		return $self->GetNextSymbolMatch(Handle, dataBuffer, sizeBuffer, MatchSize, Offset);
	}

	HRESULT GetSymbolPath_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolPath(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetImagePath_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetImagePath(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourcePath_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourcePath(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourcePathElement_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourcePathElement(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT FindSourceFile_(ULONG StartElement, PCSTR File, ULONG Flags, PULONG FoundElement, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->FindSourceFile(StartElement, File, Flags, FoundElement, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourceFileLineOffsets_(PCSTR File, ByteArray* buffer)
	{
		return CallWithBufferExtension<ULONG64>(buffer, [&](PULONG64 Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourceFileLineOffsets(File, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetModuleVersionInformation_(ULONG Index, ULONG64 Base, PCSTR Item, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetModuleVersionInformation(Index, Base, Item, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetModuleNameString_(ULONG Which, ULONG Index, ULONG64 Base, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetModuleNameString(Which, Index, Base, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetConstantName_(ULONG64 Module, ULONG TypeId, ULONG64 Value, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetConstantName(Module, TypeId, Value, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetFieldName_(ULONG64 Module, ULONG TypeId, ULONG FieldIndex, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetFieldName(Module, TypeId, FieldIndex, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetNameByOffsetWide_(ULONG64 Offset, ByteArray* nameBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<WCHAR>(nameBuffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetNameByOffsetWide(Offset, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetNearNameByOffsetWide_(ULONG64 Offset, LONG Delta, ByteArray* nameBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<WCHAR>(nameBuffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetNearNameByOffsetWide(Offset, Delta, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetLineByOffsetWide_(ULONG64 Offset, PULONG Line, ByteArray* fileBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<WCHAR>(fileBuffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetLineByOffsetWide(Offset, Line, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetTypeNameWide_(ULONG64 Module, ULONG TypeId, ByteArray* nameBuffer)
	{
		return CallWithBufferExtension<WCHAR>(nameBuffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetTypeNameWide(Module, TypeId, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetNextSymbolMatchWide_(ULONG64 Handle, ByteArray* buffer, PULONG MatchSize, PULONG64 Offset)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Buffer, WCHAR, buffer);
		return $self->GetNextSymbolMatchWide(Handle, dataBuffer, sizeBuffer, MatchSize, Offset);
	}

	HRESULT GetSymbolPathWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolPathWide(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetImagePathWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetImagePathWide(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourcePathWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourcePathWide(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourcePathElementWide_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourcePathElementWide(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT FindSourceFileWide_(ULONG StartElement, PCWSTR File, ULONG Flags, PULONG FoundElement, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->FindSourceFileWide(StartElement, File, Flags, FoundElement, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourceFileLineOffsetsWide_(PCWSTR File, ByteArray* buffer)
	{
		return CallWithBufferExtension<ULONG64>(buffer, [&](PULONG64 Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourceFileLineOffsetsWide(File, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetModuleVersionInformationWide_(ULONG Index, ULONG64 Base, PCWSTR Item, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetModuleVersionInformationWide(Index, Base, Item, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetModuleNameStringWide_(ULONG Which, ULONG Index, ULONG64 Base, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetModuleNameStringWide(Which, Index, Base, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetConstantNameWide_(ULONG64 Module, ULONG TypeId, ULONG64 Value, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetConstantNameWide(Module, TypeId, Value, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetFieldNameWide_(ULONG64 Module, ULONG TypeId, ULONG FieldIndex, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetFieldNameWide(Module, TypeId, FieldIndex, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetFunctionEntryByOffset_(ULONG64 Offset, ULONG Flags, ByteArray* buffer)
	{
		return CallWithBufferExtension<BYTE>(buffer, [&](PVOID Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetFunctionEntryByOffset(Offset, Flags, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolEntriesByOffset_(ULONG64 Offset, ULONG Flags, ByteArray* ids, ByteArray* displacements)
	{
		return CallWith2BufferExtension<DEBUG_MODULE_AND_ID, ULONG64>(ids, displacements,
			[&](PDEBUG_MODULE_AND_ID Buffer1, ULONG BufferSize1, PULONG ReqSize1, PULONG64 Buffer2, ULONG BufferSize2, PULONG ReqSize2) -> HRESULT {
				ULONG BufSize = (BufferSize1 > BufferSize2) ? BufferSize2 : BufferSize1;
				HRESULT res = $self->GetSymbolEntriesByOffset(Offset, Flags, Buffer1, Buffer2, BufSize, ReqSize1);
				*ReqSize2 = *ReqSize1;
				return res;
		});
	}

	HRESULT GetSymbolEntriesByName_(PCSTR Symbol, ULONG Flags, ByteArray* ids)
	{
		return CallWithBufferExtension<DEBUG_MODULE_AND_ID>(ids, [&](PDEBUG_MODULE_AND_ID Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolEntriesByName(Symbol, Flags, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolEntriesByNameWide_(PCWSTR Symbol, ULONG Flags, ByteArray* ids)
	{
		return CallWithBufferExtension<DEBUG_MODULE_AND_ID>(ids, [&](PDEBUG_MODULE_AND_ID Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolEntriesByNameWide(Symbol, Flags, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolEntryString_(PDEBUG_MODULE_AND_ID Id, ULONG Which, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolEntryString(Id, Which, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolEntryStringWide_(PDEBUG_MODULE_AND_ID Id, ULONG Which, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolEntryStringWide(Id, Which, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolEntryOffsetRegions_(PDEBUG_MODULE_AND_ID Id, ULONG Flags, ByteArray* regions)
	{
		return CallWithBufferExtension<DEBUG_OFFSET_REGION>(regions, [&](PDEBUG_OFFSET_REGION Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolEntryOffsetRegions(Id, Flags, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourceEntriesByOffset_(ULONG64 Offset, ULONG Flags, ByteArray* entries)
	{
		return CallWithBufferExtension<DEBUG_SYMBOL_SOURCE_ENTRY>(entries, [&](PDEBUG_SYMBOL_SOURCE_ENTRY Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourceEntriesByOffset(Offset, Flags, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourceEntriesByLine_(ULONG Line, PCSTR File, ULONG Flags, ByteArray* entries)
	{
		return CallWithBufferExtension<DEBUG_SYMBOL_SOURCE_ENTRY>(entries, [&](PDEBUG_SYMBOL_SOURCE_ENTRY Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourceEntriesByLine(Line, File, Flags, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourceEntriesByLineWide_(ULONG Line, PCWSTR File, ULONG Flags, ByteArray* entries)
	{
		return CallWithBufferExtension<DEBUG_SYMBOL_SOURCE_ENTRY>(entries, [&](PDEBUG_SYMBOL_SOURCE_ENTRY Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourceEntriesByLineWide(Line, File, Flags, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourceEntryString_(PDEBUG_SYMBOL_SOURCE_ENTRY Entry, ULONG Which, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourceEntryString(Entry, Which, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourceEntryStringWide_(PDEBUG_SYMBOL_SOURCE_ENTRY Entry, ULONG Which, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourceEntryStringWide(Entry, Which, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSourceEntryOffsetRegions_(PDEBUG_SYMBOL_SOURCE_ENTRY Entry, ULONG Flags, ByteArray* regions)
	{
		return CallWithBufferExtension<DEBUG_OFFSET_REGION>(regions, [&](PDEBUG_OFFSET_REGION Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSourceEntryOffsetRegions(Entry, Flags, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetScopeEx_(PULONG64 InstructionOffset, PDEBUG_STACK_FRAME_EX ScopeFrame, ByteArray* scopeContext)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(ScopeContext, BYTE, scopeContext);
		return $self->GetScopeEx(InstructionOffset, ScopeFrame, dataScopeContext, sizeScopeContext);
	}

	HRESULT SetScopeEx_(ULONG64 InstructionOffset, PDEBUG_STACK_FRAME_EX ScopeFrame, ByteArray* scopeContext)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(ScopeContext, BYTE, scopeContext);
		return $self->SetScopeEx(InstructionOffset, ScopeFrame, dataScopeContext, sizeScopeContext);
	}

	HRESULT GetNameByInlineContext_(ULONG64 Offset, ULONG InlineContext, ByteArray* nameBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<char>(nameBuffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetNameByInlineContext(Offset, InlineContext, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetNameByInlineContextWide_(ULONG64 Offset, ULONG InlineContext, ByteArray* nameBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<WCHAR>(nameBuffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetNameByInlineContextWide(Offset, InlineContext, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetLineByInlineContext_(ULONG64 Offset, ULONG InlineContext, PULONG Line, ByteArray* fileBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<char>(fileBuffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetLineByInlineContext(Offset, InlineContext, Line, Buffer, BufferSize, ReqSize, Displacement);
		});
	}

	HRESULT GetLineByInlineContextWide_(ULONG64 Offset, ULONG InlineContext, PULONG Line, ByteArray* fileBuffer, PULONG64 Displacement)
	{
		return CallWithBufferExtension<WCHAR>(fileBuffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetLineByInlineContextWide(Offset, InlineContext, Line, Buffer, BufferSize, ReqSize, Displacement);
		});
	}
}


//////////////////////////////////////////////////////////////////////////
%extend IDebugSymbolGroup2
{
	HRESULT GetSymbolName_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolName(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolParameters_(ULONG Start, ByteArray* params)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Params, DEBUG_SYMBOL_PARAMETERS, params);
		return $self->GetSymbolParameters(Start, sizeParams, dataParams);
	}

	HRESULT GetSymbolNameWide_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolNameWide(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolTypeName_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolTypeName(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolTypeNameWide_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolTypeNameWide(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolValueText_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolValueText(Index, Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSymbolValueTextWide_(ULONG Index, ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetSymbolValueTextWide(Index, Buffer, BufferSize, ReqSize);
		});
	}
}


//////////////////////////////////////////////////////////////////////////
%extend IDebugSystemObjects4
{
	HRESULT GetThreadIdsByIndex_(ULONG Start, ByteArray* ids, ByteArray* sysIds)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Ids, ULONG, ids);
		GET_BUFFER_FROM_BYTE_ARRAY(SysIds, ULONG, sysIds);
		ULONG count = sizeIds > sizeSysIds ? sizeSysIds : sizeIds;
		return $self->GetThreadIdsByIndex(Start, count, dataIds, dataSysIds);
	}

	HRESULT GetProcessIdsByIndex_(ULONG Start, ByteArray* ids, ByteArray* sysIds)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Ids, ULONG, ids);
		GET_BUFFER_FROM_BYTE_ARRAY(SysIds, ULONG, sysIds);
		ULONG count = sizeIds > sizeSysIds ? sizeSysIds : sizeIds;
		return $self->GetProcessIdsByIndex(Start, count, dataIds, dataSysIds);
	}

	HRESULT GetCurrentProcessExecutableName_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetCurrentProcessExecutableName(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetSystemIdsByIndex_(ULONG Start, ByteArray* ids)
	{
		GET_BUFFER_FROM_BYTE_ARRAY(Ids, ULONG, ids);
		return $self->GetSystemIdsByIndex(Start, sizeIds, dataIds);
	}

	HRESULT GetCurrentSystemServerName_(ByteArray* buffer)
	{
		return CallWithBufferExtension<char>(buffer, [&](PSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetCurrentSystemServerName(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetCurrentProcessExecutableNameWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetCurrentProcessExecutableNameWide(Buffer, BufferSize, ReqSize);
		});
	}

	HRESULT GetCurrentSystemServerNameWide_(ByteArray* buffer)
	{
		return CallWithBufferExtension<WCHAR>(buffer, [&](PWSTR Buffer, ULONG BufferSize, PULONG ReqSize){
			return $self->GetCurrentSystemServerNameWide(Buffer, BufferSize, ReqSize);
		});
	}
}

